<template>
  <div>
    <el-card class="mained">
      <!-- 游戏选择 -->
      <div class="main">
        <div class="titleOne one">虞都属性</div>
        <div class="titleOne two">{{ Name }}属性</div>
      </div>
      <!-- one -->
      <div v-if="!switchFlag">
        <div class="box">
          <div class="one two">
            <div class="nav">
              <div>虞都游戏名称：</div>
              <div>
                <el-select
                  v-model="queryParams.gameId"
                  placeholder="请选择游戏"
                  size="small"
                  clearable
                  filterable
                  @change="changfn"
                >
                  <el-option
                    v-for="dict in gameList"
                    :key="dict.id"
                    :label="dict.name"
                    :value="dict.id"
                  />
                </el-select>
              </div>
            </div>
          </div>
          <div class="one three">
            <div class="nav">
              <div>{{ Name }}游戏名称：</div>
              <div>
                <el-select
                  v-model="queryParams.interGameId"
                  placeholder="请选择游戏"
                  size="small"
                  clearable
                  filterable
                  @change="changeONe"
                >
                  <el-option
                    v-for="dict in otherList"
                    :key="dict.id"
                    :label="dict.gameName"
                    :value="dict.id"
                  />
                </el-select>
              </div>
            </div>
          </div>
        </div>
        <!-- 选择游戏进行下一步 -->
        <div class="gameBtn">
          <el-button
            style="
              background-color: #942d9b;
              border: 1px solid #942d9b;
              margin-top: 66px;
            "
            @click="xiayibu"
            type="primary"
            >下一步</el-button
          >
        </div>
      </div>
      <!-- two -->
      <div v-if="switch1">
        <!-- 一键匹配区服 -->
        <div class="gameBtn">
          <el-button
            style="background-color: #942d9b; border: 1px solid #942d9b"
            @click="OneclickmatchingAttribute"
            type="primary"
            >一键匹配区服</el-button
          >
        </div>
        <!-- 区服匹配 -->
        <div class="box" style="padding-top: 30px" v-loading="loading">
          <div class="one two" style="padding: 0 10px">
            <!-- <div class="title">虞都属性</div> -->
            <div class="">
              <div
                style="
                  font-size: 18px;
                  padding-bottom: 20px;
                  color: #942d9b;
                  font-weight: 600;
                "
              >
                虞都游戏区服
              </div>
              <div>
                <el-table
                  v-if="refreshTable"
                  :row-key="rowKeyFunc"
                  :default-expand-all="isExpandAll"
                  :data="YdQuFuList"
                  :tree-props="{
                    children: 'childGameAttributes',
                    hasChildren: 'hasChildren',
                  }"
                  border
                  height="calc(100vh - 290px)"
                >
                  <el-table-column
                    label="属性编号"
                    width="188px"
                    align="left"
                    prop="id"
                  />
                  <el-table-column label="属性名称" align="" prop="fieldName" />
                </el-table>
              </div>
            </div>
          </div>
          <div class="one three" style="padding: 0 10px">
            <!-- <div class="title">氪金兽属性</div> -->
            <div class="">
              <div
                style="
                  font-size: 18px;
                  padding-bottom: 20px;
                  color: #942d9b;
                  font-weight: 600;
                "
              >
                {{ Name }}游戏区服
              </div>
              <div>
                <el-table
                  v-if="refreshTable"
                  :row-key="rowKeyFuncOneServe"
                  :default-expand-all="isExpandAll"
                  :data="KJSQuFuList"
                  :tree-props="{
                    children: 'interServerRes',
                    hasChildren: 'hasChildren',
                  }"
                  border
                  height="calc(100vh - 290px)"
                >
                  <el-table-column
                    label="属性编号"
                    width="126px"
                    align="left"
                    prop="id"
                  />
                  <el-table-column label="属性名称" align="" prop="name" />
                  <el-table-column
                    label="虞都属性Id"
                    align=""
                    prop="YdServeId"
                  />
                  <el-table-column
                    label="虞都属性名称"
                    align=""
                    prop="YdServeName"
                  />
                  <el-table-column
                    label="操作"
                    align=""
                    class-name="small-padding fixed-width"
                    width="110"
                  >
                    <template slot-scope="scope">
                      <el-button
                        size="mini"
                        type="text"
                        icon="el-icon-edit"
                        :class="{
                          active: scope.row.flag == true || scope.row.type,
                        }"
                        @click="handleUpdate(scope.row, scope.$index)"
                        >匹配</el-button
                      >
                      <el-button
                        size="mini"
                        type="text"
                        icon="el-icon-refresh-left"
                        @click="chongzhiQUFU(scope.row, scope.$index)"
                        >重置</el-button
                      >
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </div>
          </div>
        </div>

        <!-- 保存区服 -->
        <div class="gameBtn">
          <el-button
            style="background-color: #942d9b; border: 1px solid #942d9b"
            @click="baocunqufu"
            type="primary"
            :disabled="dislable"
            >保存区服属性</el-button
          >
        </div>
      </div>
      <!-- three -->
      <div v-if="switch2">
        <!-- 一键匹配区服 -->
        <div class="gameBtn">
          <el-button
            style="background-color: #942d9b; border: 1px solid #942d9b"
            @click="Oneclickradio"
            type="primary"
            >一键匹配单选属性</el-button
          >
        </div>

        <!-- 属性匹配 -->
        <div class="box" style="padding-top: 30px" v-loading="loading">
          <div class="one two" style="padding: 0 10px">
            <!-- <div class="title">虞都属性</div> -->
            <div class="">
              <div
                style="
                  font-size: 18px;
                  padding-bottom: 20px;
                  color: #942d9b;
                  font-weight: 600;
                "
              >
                虞都单选属性
              </div>
              <div>
                <el-table
                  v-if="refreshTable"
                  :row-key="rowKeyAttr"
                  :default-expand-all="isExpandAll"
                  :data="YdAttr"
                  :tree-props="{
                    children: 'childAttributes',
                    hasChildren: 'hasChildren',
                  }"
                  border
                  height="calc(100vh - 290px)"
                >
                  <el-table-column
                    label="属性编号"
                    width="188px"
                    align="left"
                    prop="id"
                  />
                  <el-table-column label="属性名称" align="" prop="fieldName" />
                </el-table>
              </div>
            </div>
          </div>
          <div class="one three" style="padding: 0 10px">
            <!-- <div class="title">氪金兽属性</div> -->
            <div class="">
              <div
                style="
                  font-size: 18px;
                  padding-bottom: 20px;
                  color: #942d9b;
                  font-weight: 600;
                "
              >
                {{ Name }}单选属性
              </div>
              <div>
                <el-table
                  v-if="refreshTable"
                  :row-key="rowKeyFuncOneServe"
                  :default-expand-all="isExpandAll"
                  :data="KJSAttr"
                  :tree-props="{
                    children: 'interRadioReqs',
                    hasChildren: 'hasChildren',
                  }"
                  border
                  height="calc(100vh - 290px)"
                >
                  <el-table-column
                    label="属性编号"
                    width="126px"
                    align="left"
                    prop="id"
                  />
                  <el-table-column label="属性名称" align="" prop="name" />
                  <el-table-column label="是否必填" align="" prop="required">
                    <template #default="{ row }">
                      <div v-if="row.required == true" style="color: red">
                        必填项
                      </div>
                      <div v-else style="color: green">不是必填项</div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="设置默认值"
                    align=""
                    prop="defaultValue"
                  />
                  <el-table-column
                    label="虞都属性Id"
                    align=""
                    prop="YdConfigId"
                  />
                  <el-table-column
                    label="虞都属性名称"
                    align=""
                    prop="YdConfigName"
                  />
                  <el-table-column
                    label="操作"
                    align=""
                    class-name="small-padding fixed-width"
                    width="110"
                  >
                    <template slot-scope="scope">
                      <el-button
                        size="mini"
                        type="text"
                        icon="el-icon-edit"
                        :class="{
                          active: scope.row.flag == true || scope.row.type,
                        }"
                        @click="handleUpdateRadio(scope.row)"
                        >匹配</el-button
                      >
                      <el-button
                        size="mini"
                        type="text"
                        icon="el-icon-thumb"
                        style="color: red"
                        @click="SetuPRadio(scope.row)"
                        >设置默认值</el-button
                      >
                      <el-button
                        size="mini"
                        type="text"
                        icon="el-icon-refresh-left"
                        @click="chongzhiRadio(scope.row)"
                        >重置</el-button
                      >
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </div>
          </div>
        </div>

        <!-- 保存单选属性 -->
        <div class="gameBtn">
          <el-button
            style="background-color: #942d9b; border: 1px solid #942d9b"
            @click="baocunRadioAttr"
            type="primary"
            :disabled="dislable"
            >保存单选属性</el-button
          >
        </div>
      </div>
      <!-- four -->
      <div v-if="switch3">
        <!-- 一键匹配多选属性 -->
        <div class="gameBtn">
          <el-button
            style="background-color: #942d9b; border: 1px solid #942d9b"
            @click="OneclickcheckBox"
            type="primary"
            >一键匹配多选属性</el-button
          >
        </div>

        <!-- 属性匹配 -->
        <div class="box" style="padding-top: 30px" v-loading="loading">
          <div class="one two" style="padding: 0 10px">
            <!-- <div class="title">虞都属性</div> -->
            <div class="">
              <div
                style="
                  font-size: 18px;
                  padding-bottom: 20px;
                  color: #942d9b;
                  font-weight: 600;
                "
              >
                虞都多选属性
              </div>
              <div>
                <el-table
                  v-if="refreshTable"
                  :row-key="rowKeyAttr"
                  :default-expand-all="isExpandAll"
                  :data="YdCheckBoxAttr"
                  :tree-props="{
                    children: 'childAttributes',
                    hasChildren: 'hasChildren',
                  }"
                  border
                  height="calc(100vh - 290px)"
                >
                  <el-table-column
                    label="属性编号"
                    width="188px"
                    align="left"
                    prop="id"
                  />
                  <el-table-column label="属性名称" align="" prop="fieldName" />
                </el-table>
              </div>
            </div>
          </div>
          <div class="one three" style="padding: 0 10px">
            <!-- <div class="title">氪金兽属性</div> -->
            <div class="">
              <div
                style="
                  font-size: 18px;
                  padding-bottom: 20px;
                  color: #942d9b;
                  font-weight: 600;
                "
              >
                {{ Name }}多选属性
              </div>
              <div>
                <el-table
                  v-if="refreshTable"
                  :row-key="rowKeyFuncOneServe"
                  :default-expand-all="isExpandAll"
                  :data="KJSCheckBoxAttr"
                  :tree-props="{
                    children: 'interCheckBoxReqs',
                    hasChildren: 'hasChildren',
                  }"
                  border
                  height="calc(100vh - 290px)"
                >
                  <el-table-column
                    label="属性编号"
                    width="126px"
                    align="left"
                    prop="id"
                  />
                  <el-table-column label="属性名称" align="" prop="name" />
                  <el-table-column label="是否必填" align="" prop="required">
                    <template #default="{ row }">
                      <div v-if="row.required == true" style="color: red">
                        必填项
                      </div>
                      <div v-else style="color: green">不是必填项</div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="设置默认值"
                    align=""
                    prop="defaultValue"
                  />
                  <el-table-column
                    label="虞都属性Id"
                    align=""
                    prop="YdConfigId"
                  />
                  <el-table-column
                    label="虞都属性名称"
                    align=""
                    prop="YdConfigName"
                  />
                  <el-table-column
                    label="操作"
                    align=""
                    class-name="small-padding fixed-width"
                    width="110"
                  >
                    <template slot-scope="scope">
                      <el-button
                        size="mini"
                        type="text"
                        icon="el-icon-edit"
                        :class="{
                          active: scope.row.flag == true || scope.row.type,
                        }"
                        @click="handleUpdatecheckBox(scope.row)"
                        >匹配</el-button
                      >
                      <el-button
                        size="mini"
                        type="text"
                        icon="el-icon-thumb"
                        style="color: red"
                        @click="SetUPCheckBox(scope.row)"
                        >设置默认值</el-button
                      >
                      <el-button
                        size="mini"
                        type="text"
                        icon="el-icon-refresh-left"
                        @click="chongzhiCheckBox(scope.row)"
                        >重置</el-button
                      >
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </div>
          </div>
        </div>

        <!-- 保存多选属性 -->
        <div class="gameBtn">
          <el-button
            style="background-color: #942d9b; border: 1px solid #942d9b"
            @click="baocunCheckBoxAttr"
            type="primary"
            :disabled="dislable"
            >保存多选属性</el-button
          >
        </div>
      </div>
      <!-- five -->
      <div v-if="switch6">
        <div class="gameBtn">
          <el-button
            style="background-color: #942d9b; border: 1px solid #942d9b"
            @click="Oneclickinput"
            type="primary"
            >一键匹配输入框属性</el-button
          >
        </div>

        <!-- 属性匹配 -->
        <div class="box" style="padding-top: 30px" v-loading="loading">
          <div class="one two" style="padding: 0 10px">
            <!-- <div class="title">虞都属性</div> -->
            <div class="">
              <div
                style="
                  font-size: 18px;
                  padding-bottom: 20px;
                  color: #942d9b;
                  font-weight: 600;
                "
              >
                虞都输入框属性
              </div>
              <div>
                <el-table
                  v-if="refreshTable"
                  :default-expand-all="isExpandAll"
                  border
                  :data="YdInputAttr"
                  height="calc(100vh - 290px)"
                >
                  <el-table-column
                    label="属性编号"
                    width="188px"
                    align="left"
                    prop="id"
                  />
                  <el-table-column label="属性名称" align="" prop="fieldName" />
                  <el-table-column label="属性字段" align="" prop="aavName" />
                </el-table>
              </div>
            </div>
          </div>
          <div class="one three" style="padding: 0 10px">
            <!-- <div class="title">氪金兽属性</div> -->
            <div class="">
              <div
                style="
                  font-size: 18px;
                  padding-bottom: 20px;
                  color: #942d9b;
                  font-weight: 600;
                "
              >
                {{ Name }}输入框属性
              </div>
              <div>
                <el-table
                  v-if="refreshTable"
                  :default-expand-all="isExpandAll"
                  border
                  :data="KJSInputAttr"
                  height="calc(100vh - 290px)"
                >
                  <el-table-column
                    label="属性编号"
                    width="126px"
                    align="left"
                    prop="id"
                  />
                  <el-table-column label="属性名称" align="" prop="name" />
                  <el-table-column label="是否必填" align="" prop="required">
                    <template #default="{ row }">
                      <div v-if="row.required == true" style="color: red">
                        必填项
                      </div>
                      <div v-else style="color: green">不是必填项</div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="设置默认值"
                    align=""
                    prop="defaultValue"
                  />
                  <el-table-column
                    label="虞都属性字段"
                    align=""
                    prop="aavName"
                  />
                  <el-table-column
                    label="虞都属性名称"
                    align=""
                    prop="fieldName"
                  />
                  <el-table-column
                    label="操作"
                    align=""
                    class-name="small-padding fixed-width"
                    width="110"
                  >
                    <template slot-scope="scope">
                      <el-button
                        size="mini"
                        type="text"
                        icon="el-icon-edit"
                        :class="{
                          active: scope.row.flag == true,
                        }"
                        @click="handleUpdateInput(scope.row)"
                        >匹配</el-button
                      >
                      <el-button
                        size="mini"
                        type="text"
                        icon="el-icon-thumb"
                        style="color: red"
                        @click="setUpInput(scope.row)"
                        >设置默认值</el-button
                      >
                      <el-button
                        size="mini"
                        type="text"
                        icon="el-icon-refresh-left"
                        @click="chongzhiInput(scope.row)"
                        >重置</el-button
                      >
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </div>
          </div>
        </div>

        <!-- 保存输入框属性 -->
        <div class="gameBtn">
          <el-button
            style="background-color: #942d9b; border: 1px solid #942d9b"
            @click="baocunInputAttr"
            type="primary"
            :disabled="dislable"
            >保存输入框属性</el-button
          >
        </div>
      </div>

      <!-- 获取单选属性 -->
      <!-- <div class="gameBtn">
        <el-button
          style="background-color: #942d9b; border: 1px solid #942d9b"
          @click="getAttrs"
          type="primary"
          >获取单选属性</el-button
        >
      </div> -->

      <!-- 获取多选属性 -->
      <!-- <div class="gameBtn">
        <el-button
          style="background-color: #942d9b; border: 1px solid #942d9b"
          @click="getcheckBoxAttrs"
          type="primary"
          >获取多选属性</el-button
        >
      </div> -->

      <!-- 获取多选属性 -->
      <!-- <div class="gameBtn">
        <el-button
          style="background-color: #942d9b; border: 1px solid #942d9b"
          @click="getInputAttr"
          type="primary"
          >获取输入框属性</el-button
        >
      </div> -->
    </el-card>
    <!-- 编辑区服 -->
    <el-dialog
      title="编辑信息"
      :visible.sync="dialogFormVisible"
      @close="close"
    >
      <el-form :model="form" label-width="100px">
        <el-form-item label="虞都属性">
          <!-- <el-input
            v-model="form.YdServeId"
            placeholder="请输入虞都属性"
            autocomplete="off"
          ></el-input> -->
          <!-- <el-cascader v-model="form.YdServeId" :options="YdQuFuList" clearable></el-cascader> -->
          <el-cascader
            style="width: 555px"
            v-model="selectedValues"
            :options="YdQuFuList"
            :props="{
              multiple: true,
              checkStrictly: true,
              value: 'id',
              label: 'fieldName',
              children: 'childGameAttributes',
            }"
            @change="handleChange"
            clearable
            filterable
            :show-all-levels="false"
          ></el-cascader>
          <!-- <div>{{ selectedValuesCsv }}</div> -->
        </el-form-item>
        <!-- <el-form-item label="虞都属性名称">
          <el-input
            v-model="form.YdServeName"
            placeholder="请输入属性名称"
            autocomplete="off"
          ></el-input>
        </el-form-item> -->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="close">取 消</el-button>
        <el-button type="primary" @click="okSure">确 定</el-button>
      </div>
    </el-dialog>
    <!-- 编辑单选 -->
    <el-dialog
      title="编辑信息"
      :visible.sync="dialogFormVisibleRadio"
      @close="closeRadio"
    >
      <el-form :model="Radioform" label-width="100px">
        <el-form-item label="虞都属性">
          <el-cascader
            style="width: 555px"
            v-model="selectedRadioValues"
            :options="YdAttr"
            :props="{
              multiple: true,
              checkStrictly: true,
              value: 'id',
              label: 'fieldName',
              children: 'childAttributes',
            }"
            @change="handleChangeRadio"
            clearable
            filterable
            :show-all-levels="false"
          ></el-cascader>
        </el-form-item>
        <!-- <el-form-item label="虞都属性名称">
          <el-input
            v-model="Radioform.YdConfigName"
            placeholder="请输入属性名称"
            autocomplete="off"
          ></el-input>
        </el-form-item> -->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="closeRadio">取 消</el-button>
        <el-button type="primary" @click="okSureRadio">确 定</el-button>
      </div>
    </el-dialog>
    <!-- 编辑多选 -->
    <el-dialog
      title="编辑信息"
      :visible.sync="dialogFormVisiblecheckBox"
      @close="closecheckBox"
    >
      <el-form :model="checkBoxform" label-width="100px">
        <el-form-item label="虞都属性">
          <el-cascader
            style="width: 555px"
            v-model="selectedRadioCheckBox"
            :options="YdCheckBoxAttr"
            :props="{
              multiple: true,
              checkStrictly: true,
              value: 'id',
              label: 'fieldName',
              children: 'childAttributes',
            }"
            @change="handleChangeCheckBox"
            clearable
            filterable
            :show-all-levels="false"
          ></el-cascader>
        </el-form-item>
        <!-- <el-form-item label="虞都属性名称">
          <el-input
            v-model="checkBoxform.YdConfigName"
            placeholder="请输入属性名称"
            autocomplete="off"
          ></el-input>
        </el-form-item> -->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="closecheckBox">取 消</el-button>
        <el-button type="primary" @click="okSurecheckBox">确 定</el-button>
      </div>
    </el-dialog>
    <!-- 编辑输入框 -->
    <el-dialog
      title="编辑信息"
      :visible.sync="dialogFormVisibleInput"
      @close="closeInput"
    >
      <el-form :model="Inputform" label-width="100px">
        <!-- <el-form-item label="虞都属性字段">
          <el-input
            v-model="Inputform.aavName"
            placeholder="请输入虞都属性字段"
            autocomplete="off"
          ></el-input>
        </el-form-item> -->
        <el-form-item label="虞都属性">
          <el-cascader
            style="width: 555px"
            v-model="selectedInput"
            :options="YdInputAttr"
            :props="{
              multiple: true,
              checkStrictly: true,
              value: 'id',
              label: 'fieldName',
              children: 'childAttributes',
            }"
            @change="handleChangeinput"
            clearable
            filterable
            :show-all-levels="false"
          ></el-cascader>
        </el-form-item>
        <!-- <el-form-item label="虞都属性名称">
          <el-input
            v-model="Inputform.fieldName"
            placeholder="请输入属性名称"
            autocomplete="off"
          ></el-input>
        </el-form-item> -->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="closeInput">取 消</el-button>
        <el-button type="primary" @click="okSureInput">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import gameListApi from "@/api/gameConfig/gameList";
import {
  getBaocunAttrInfo,
  BaocunInputAttrInfo,
  BaocunCheckBoxAttrInfo,
  listInfo,
  getQufuList,
  getOTHERQufuList,
  getYDQufuList,
  BaocunQuFu,
  YDAttr,
  KJSAttr,
  BaocunRadioAttrInfo,
} from "../../api/AttributeCorrection/index";
export default {
  data() {
    return {
      loading: false,
      dislable: false,
      indexNum: null,
      switchFlag: false,
      switch1: false,
      switch2: false,
      switch3: false,
      switch6: false,
      gameList: [],
      Name: null,
      selectedValues: [],
      selectedRadioValues: [],
      selectedRadioCheckBox: [],
      selectedInput: [],
      queryParams: {
        gameId: null,
        gameName: null,
        interGameId: null,
        interGameName: null,
        config: null,
      },
      form: {
        YdServeId: null,
        YdServeName: null,
      },
      Radioform: {
        YdConfigId: null,
        YdConfigName: null,
      },
      checkBoxform: {
        YdConfigId: null,
        YdConfigName: null,
      },
      Inputform: {
        aavName: null,
        fieldName: null,
      },
      dialogFormVisible: false,
      dialogFormVisibleRadio: false,
      dialogFormVisiblecheckBox: false,
      dialogFormVisibleInput: false,
      otherList: [],
      YdQuFuList: [],
      KJSQuFuList: [],
      YdAttr: [],
      KJSAttr: [],
      YdCheckBoxAttr: [],
      KJSCheckBoxAttr: [],
      YdInputAttr: [],
      KJSInputAttr: [],
      refreshTable: true,
      isExpandAll: false,
      itemObj: {},
      itemObjRadio: {},
      itemObjcheckBox: {},
      itemObjInput: {},
      AllInfoList: {},
      salePartner: {},
      paramsData: {},
    };
  },
  computed: {
    // selectedValuesCsv() {
    //   return this.selectedValues.join(', ');
    // }
  },
  created() {
    const data = this.$route.query;
    console.log("data", data);
    this.paramsData = { ...JSON.parse(data.paramsData) };
    this.Name = data.Name;
    this.queryParams.config = data.Id;
    this.getGameList();
    this.getOtherList();
  },
  methods: {
    ////////////////////////////////////////区服
    // handleItemChange(item) {
    //   // Handle leaf node selection
    //   console.log('123567', item);
    //   //   if (item) {
    //   //     this.selectedValues.push(item);
    //   //   }
    // },
    // @active-item-change="handleItemChange"

    handleChange(value) {
      console.log("33333", value);
      let arr = [];
      value.forEach((item) => {
        console.log("item", item);
        arr.push(item.slice(-1)[0]);
      });
      console.log("arrrrr", arr);
      // 提取并输出ID和名称
      const ids = [];
      const names = [];
      arr.forEach((path) => {
        console.log("path", path);
        const node = this.findNodeById(this.YdQuFuList, path);
        console.log("3333333", node);
        if (node) {
          ids.push(node.id);
          names.push(node.fieldName);
        }
      });
      console.log("选中的ID:", ids);
      this.form.YdServeId = ids.join(", ");
      console.log("选中的名称:", names);
      this.form.YdServeName = names.join(", ");
    },
    findNodeById(nodes, id) {
      console.log("123", nodes, id);
      for (let i = 0; i < nodes.length; i++) {
        if (nodes[i].id === id) {
          return nodes[i];
        }
        if (
          nodes[i].childGameAttributes &&
          nodes[i].childGameAttributes.length > 0
        ) {
          const found = this.findNodeById(nodes[i].childGameAttributes, id);
          if (found) {
            return found;
          }
        }
      }
      return null;
    },

    ////////////////////////////////////////单选

    handleChangeRadio(value) {
      console.log("33333", value);
      let arr = [];
      value.forEach((item) => {
        console.log("item", item);
        arr.push(item.slice(-1)[0]);
      });
      console.log("arrrrr", arr);

      // 提取并输出ID和名称
      const ids = [];
      const names = [];
      arr.forEach((path) => {
        console.log("path", path);
        const node = this.findNodeByIdRadio(this.YdAttr, path);
        console.log("3333333", node);
        if (node) {
          ids.push(node.id);
          names.push(node.fieldName);
        }
      });

      console.log("选中的ID:", ids);
      this.Radioform.YdConfigId = ids.join(", ");
      console.log("选中的名称:", names);
      this.Radioform.YdConfigName = names.join(", ");
    },
    findNodeByIdRadio(nodes, id) {
      console.log("123", nodes, id);
      for (let i = 0; i < nodes.length; i++) {
        if (nodes[i].id === id) {
          return nodes[i];
        }
        if (nodes[i].childAttributes && nodes[i].childAttributes.length > 0) {
          const found = this.findNodeByIdRadio(nodes[i].childAttributes, id);
          if (found) {
            return found;
          }
        }
      }
      return null;
    },

    ////////////////////////////////////////多选

    handleChangeCheckBox(value) {
      console.log("33333", value);
      let arr = [];
      value.forEach((item) => {
        console.log("item", item);
        arr.push(item.slice(-1)[0]);
      });
      console.log("arrrrr", arr);

      // 提取并输出ID和名称
      const ids = [];
      const names = [];
      arr.forEach((path) => {
        console.log("path", path);
        const node = this.findNodeByIdCheckBox(this.YdCheckBoxAttr, path);
        console.log("3333333", node);
        if (node) {
          ids.push(node.id);
          names.push(node.fieldName);
        }
      });

      console.log("选中的ID:", ids);
      this.checkBoxform.YdConfigId = ids.join(", ");
      console.log("选中的名称:", names);
      this.checkBoxform.YdConfigName = names.join(", ");
    },
    findNodeByIdCheckBox(nodes, id) {
      console.log("123", nodes, id);
      for (let i = 0; i < nodes.length; i++) {
        if (nodes[i].id === id) {
          return nodes[i];
        }
        if (nodes[i].childAttributes && nodes[i].childAttributes.length > 0) {
          const found = this.findNodeByIdCheckBox(nodes[i].childAttributes, id);
          if (found) {
            return found;
          }
        }
      }
      return null;
    },

    ////////////////////////////////////////输入框

    handleChangeinput(value) {
      console.log("33333", value);
      //   let arr = []
      //   value.forEach(item => {
      //     console.log('item', item);
      //     arr.push(item.slice(-1)[0])
      //   })
      //   console.log("arrrrr", arr);

      // 提取并输出ID和名称
      const ids = [];
      const names = [];
      value.forEach((path1) => {
        path1.forEach((path) => {
          console.log("path", path);
          const node = this.findNodeByIdInput(this.YdInputAttr, path);
          console.log("3333333", node);
          if (node) {
            ids.push(node.aavName);
            names.push(node.fieldName);
          }
        });
      });

      console.log("选中的ID:", ids);
      this.Inputform.aavName = ids.join(", ");
      console.log("选中的名称:", names);
      this.Inputform.fieldName = names.join(", ");
    },
    findNodeByIdInput(nodes, id) {
      console.log("123", nodes, id);
      for (let i = 0; i < nodes.length; i++) {
        if (nodes[i].id === id) {
          return nodes[i];
        }
        if (nodes[i].childAttributes && nodes[i].childAttributes.length > 0) {
          const found = this.findNodeByIdInput(nodes[i].childAttributes, id);
          if (found) {
            return found;
          }
        }
      }
      return null;
    },

    //单选设置默认值
    SetuPRadio(item) {
      console.log("item", item);
      item.defaultValue = item.id;
      this.refreshTable = false;
      this.isExpandAll = false;
      this.$nextTick(() => {
        this.refreshTable = true;
      });
    },

    //多选设置默认值
    SetUPCheckBox(item) {
      console.log("item", item);
      item.defaultValue = item.id;
      this.refreshTable = false;
      this.isExpandAll = false;
      this.$nextTick(() => {
        this.refreshTable = true;
      });
    },

    //输入框设置默认值
    setUpInput(item) {
      console.log("item", item);
      item.defaultValue = item.id;
      this.refreshTable = false;
      this.isExpandAll = false;
      this.$nextTick(() => {
        this.refreshTable = true;
      });
    },

    //区服选择重置
    chongzhiQUFU(item, index) {
      console.log("item", item);
      item.InterServeId = null;
      item.InterServeName = null;
      item.YdServeId = null;
      item.YdServeName = null;
      item.defaultValue = null;
      const ddd = document.querySelector(".mained");
      ddd.style.width = "1292px";
    },

    //单选选择重置
    chongzhiRadio(item) {
      console.log("item", item);
      item.InterConfigId = null;
      item.InterConfigName = null;
      item.YdConfigId = null;
      item.YdConfigName = null;
      item.defaultValue = null;
      const ddd = document.querySelector(".mained");
      ddd.style.width = "1292px";
    },

    //多选选择重置
    chongzhiCheckBox(item) {
      console.log("item", item);
      item.InterConfigId = null;
      item.InterConfigName = null;
      item.YdConfigId = null;
      item.YdConfigName = null;
      item.defaultValue = null;
      const ddd = document.querySelector(".mained");
      ddd.style.width = "1292px";
    },

    //输入框选择重置
    chongzhiInput(item) {
      console.log("item", item);
      item.aavName = null;
      item.fieldName = null;
      item.interId = null;
      item.interName = null;
      item.defaultValue = null;
      const ddd = document.querySelector(".mained");
      ddd.style.width = "1292px";
    },

    //保存区服
    async baocunqufu() {
      let obj = {};
      obj.config = this.salePartner.saleName;
      obj.ydGameId = this.queryParams.gameId;
      obj.interGameId = this.queryParams.interGameId;
      obj.interServeReqs = JSON.stringify(this.KJSQuFuList);
      console.log("obj.interServeReqs", obj.interServeReqs);
      const res = await BaocunQuFu({ ...this.paramsData, ...obj });
      console.log(res);
      if (res.code == 200) {
        // this.getAttrs()
        this.getYdAttr();
        this.getotherAttr();
        this.switch1 = false;
        this.switch2 = true;
      }
      this.$message.success("保存成功！");
    },
    //修改本地数据-区服
    handleUpdate(item, index) {
      const ddd = document.querySelector(".mained");
      ddd.style.width = "1286px";
      console.log("item", item);
      console.log("index", index);
      this.indexNum = index;
      this.selectedValues = [];
      this.itemObj = item;
      this.dialogFormVisible = true;
      this.form.YdServeId = item.YdServeId;
      this.form.YdServeName = item.YdServeName;
    },
    //确认区服
    okSure() {
      this.itemObj.YdServeId = this.form.YdServeId;
      this.itemObj.YdServeName = this.form.YdServeName;
      this.itemObj.InterServeId = this.itemObj.id;
      this.itemObj.InterServeName = this.itemObj.name;
      const myList = this.YdQuFuList;
      const otherList = this.KJSQuFuList;
      this.dialogFormVisible = false;
      myList.forEach((item) => {
        console.log("123", 123);
        otherList.forEach((dict) => {
          console.log("123", 123567);
          if (item.filedName == dict.name || dict.YdServeId == item.id) {
            // dict.YdServeId = item.id
            // dict.YdServeName = item.fieldName
            // console.log(dict.YdServeId);
            item.flag = true;
            dict.flag = true;
          }

          if (
            item.childGameAttributes &&
            item.childGameAttributes.length != 0
          ) {
            item.childGameAttributes.forEach((i) => {
              if (dict.interServerRes && dict.interServerRes.length != 0) {
                dict.interServerRes.forEach((s) => {
                  if (i.fieldName == s.name || s.YdServeId == i.id) {
                    //   s.YdServeId = i.id
                    //   s.YdServeName = i.fieldName
                    //   console.log('sss', s);
                    s.flag = true;
                    i.flag = true;
                  }

                  if (
                    i.childGameAttributes &&
                    i.childGameAttributes.length != 0
                  ) {
                    i.childGameAttributes.forEach((t1) => {
                      if (t1.fieldName == s.name || s.YdServeId == t1.id) {
                        //   s.YdServeId = t1.id
                        //   s.YdServeName = t1.fieldName
                        s.flag = true;
                        t1.flag = true;
                      }

                      if (
                        t1.childGameAttributes &&
                        t1.childGameAttributes.length != 0
                      ) {
                        t1.childGameAttributes.forEach((t2) => {
                          if (t2.fieldName == s.name || s.YdServeId == t2.id) {
                            //   s.YdServeId = t2.id
                            //   s.YdServeName = t2.fieldName
                            s.flag = true;
                            t2.flag = true;
                          }
                        });
                      }
                    });
                  }
                });
              }
            });
          }
        });
      });

      this.$set(this.KJSQuFuList, this.itemObj.id + "qwer", this.itemObj);
      const ddd = document.querySelector(".mained");
      ddd.style.width = "1290px";

      // this.refreshTable = false;
      // // this.isExpandAll = false;
      // this.$nextTick(() => {
      //   this.refreshTable = true;
      // });
      // this.$nextTick(() => {
      //   this.$forceUpdate()
      // });
    },
    //清楚区服表单
    close() {
      this.dialogFormVisible = false;
      this.form = {
        YdServeId: null,
        YdServeName: null,
      };
    },
    //一键匹配区服属性
    OneclickmatchingAttribute() {
      const myList = this.YdQuFuList;
      const otherList = this.KJSQuFuList;
      myList.forEach((item) => {
        otherList.forEach((dict) => {
          if (item.fieldName == dict.name) {
            dict.YdServeId = item.id;
            dict.YdServeName = item.fieldName;
            dict.InterServeId = dict.id;
            dict.InterServeName = dict.name;
            item.flag = true;
            dict.flag = true;
          }
          if (
            item.childGameAttributes &&
            item.childGameAttributes.length != 0
          ) {
            item.childGameAttributes.forEach((i) => {
              if (dict.interServerRes && dict.interServerRes.length != 0) {
                dict.interServerRes.forEach((s) => {
                  if (i.fieldName == s.name) {
                    s.YdServeId = i.id;
                    s.YdServeName = i.fieldName;
                    s.InterServeId = s.id;
                    s.InterServeName = s.name;
                  }

                  if (
                    i.childGameAttributes &&
                    i.childGameAttributes.length != 0
                  ) {
                    i.childGameAttributes.forEach((i1) => {
                      if (s.interServerRes && s.interServerRes.length != 0) {
                        s.interServerRes.forEach((s1) => {
                          if (i1.fieldName == s1.name) {
                            s1.YdServeId = i1.id;
                            s1.YdServeName = i1.fieldName;
                            s1.InterServeId = s1.id;
                            s1.InterServeName = s1.name;
                          }

                          if (
                            i1.childGameAttributes &&
                            i1.childGameAttributes.length != 0
                          ) {
                            i1.childGameAttributes.forEach((i2) => {
                              if (
                                s1.interServerRes &&
                                s1.interServerRes.length != 0
                              ) {
                                s1.interServerRes.forEach((s2) => {
                                  if (i2.fieldName == s2.name) {
                                    s2.YdServeId = i2.id;
                                    s2.YdServeName = i2.fieldName;
                                    s2.InterServeId = s2.id;
                                    s2.InterServeName = s2.name;
                                  }
                                });
                              }
                            });
                          }
                        });
                      }
                    });
                  }
                });
              }
            });
          }
        });
      });

      this.refreshTable = false;
      this.isExpandAll = false;
      this.$nextTick(() => {
        this.refreshTable = true;
      });
    },
    rowKeyFunc(row) {
      // console.log('66666666', row);
      if (row.childGameAttributes != null) {
        return row.uuid + "only";
      }
      return row.uuid;
    },
    rowKeyAttr(row) {
      if (row.id) {
        return row.id;
      }
      return row.id;
    },
    rowKeyFuncOne(row) {
      //   console.log('66666666', row);
      if (row.interServerRes) return row.id + "onlyTwo";
      return row.id;
    },
    rowKeyFuncOneServe(row) {
      //   console.log('66666666', row);
      if (row.interServerRes) return row.uuid + "onlyTwo";
      return row.uuid;
    },
    // tableCellStyle({ row, column, rowIndex, columnIndex }) {
    //   //   console.log('row', row);
    //   //   console.log('column', column);
    //   //   console.log('rowIndex', rowIndex);
    //   //   console.log('columnIndex', columnIndex);
    //   const fieldLabel = row.flag;
    //   if (fieldLabel == true) {
    //     return { 'background-color': '#942d9b', 'color': '#fff' };
    //   }
    // },
    // 游戏列表
    getGameList() {
      gameListApi.getGameList().then((res) => {
        this.gameList = res.rows;
      });
    },
    getOtherList() {
      // listInfo(this.queryParams.config).then((res) => {
      //   this.otherList = res.data;
      // });
      this.otherList = JSON.parse(localStorage.getItem("AttrList"));
      this.salePartner = JSON.parse(localStorage.getItem("listAttrInfo"));
    },
    async xiayibu() {
      this.queryParams.config = this.salePartner.saleName;
      console.log(
        "%c Line:1435 🍡 this.queryParams",
        "color:#93c0a4",
        this.queryParams
      );
      const res = await getQufuList({
        ...this.paramsData,
        ...this.queryParams,
      });
      console.log(res);
      if (res.code == 200) {
        this.switchFlag = true;
        this.switch1 = true;
        this.getbaocunInfoList();
        this.getYdList();
      }
    },
    changfn(e) {
      const obj = this.gameList.filter((item) => item.id == e);
      console.log(obj);
      this.queryParams.gameName = obj[0].name;
    },
    changeONe(e) {
      const obj = this.otherList.filter((item) => item.id == e);
      console.log(obj);
      this.queryParams.interGameName = obj[0].gameName;
    },
    async getYdList() {
      let obj = {};
      obj.gameId = this.queryParams.gameId;
      const res = await getYDQufuList(obj);
      console.log(res);
      this.YdQuFuList = res.data;
    },
    async getotherList() {
      let obj = {};
      obj.gameId = this.queryParams.interGameId;
      obj.saleName = this.salePartner.saleName;
      const res = await getOTHERQufuList({ ...this.paramsData, ...obj });
      console.log(res);
      if (this.AllInfoList.server) {
        this.loading = true;
        this.dislable = true;
        res.data.forEach((item) => {
          this.AllInfoList.server.interServeReqs.forEach((dict) => {
            if (item.id == dict.id && dict.YdServeId && dict.YdServeName) {
              item.YdServeId = dict.YdServeId;
              item.YdServeName = dict.YdServeName;
              item.InterServeId = dict.InterServeId;
              item.InterServeName = dict.InterServeName;
              if (dict.interServerRes && dict.interServerRes.length != 0) {
                item.interServerRes.forEach((t1) => {
                  dict.interServerRes.forEach((s1) => {
                    if (t1.id == s1.id && s1.YdServeId && s1.YdServeName) {
                      console.log("333", "55555555555555666");
                      t1.YdServeId = s1.YdServeId;
                      t1.YdServeName = s1.YdServeName;
                      t1.InterServeId = s1.InterServeId;
                      t1.InterServeName = s1.InterServeName;
                      if (s1.interServerRes && s1.interServerRes.length != 0) {
                        t1.interServerRes.forEach((t2) => {
                          s1.interServerRes.forEach((s2) => {
                            if (
                              t2.id == s2.id &&
                              s2.YdServeId &&
                              s2.YdServeName
                            ) {
                              console.log("333", "55555555555555");

                              t2.YdServeId = s2.YdServeId;
                              t2.YdServeName = s2.YdServeName;
                              t2.InterServeId = s2.InterServeId;
                              t2.InterServeName = s2.InterServeName;
                              if (
                                s2.interServerRes &&
                                s2.interServerRes.length != 0
                              ) {
                                t2.interServerRes.forEach((t3) => {
                                  s2.interServerRes.forEach((s3) => {
                                    if (
                                      t3.id == s3.id &&
                                      s3.YdServeId &&
                                      s3.YdServeName
                                    ) {
                                      t3.YdServeId = s3.YdServeId;
                                      t3.YdServeName = s3.YdServeName;
                                      t3.InterServeId = s3.InterServeId;
                                      t3.InterServeName = s3.InterServeName;
                                    }
                                  });
                                });
                              }
                            }
                          });
                        });
                      }
                    }
                  });
                });
              }
            }

            // if (item.id == dict.id) {
            //   if (dict.interServerRes && dict.interServerRes.length != 0) {
            //     item.interServerRes.forEach(t1 => {
            //       dict.interServerRes.forEach(s1 => {
            //         if (t1.id == s1.id && s1.YdServeId && s1.YdServeName) {
            //           t1.YdServeId = s1.YdServeId
            //           t1.YdServeName = s1.YdServeName
            //           t1.InterServeId = s1.InterServeId
            //           t1.InterServeName = s1.InterServeName
            //         }
            //       })
            //     })
            //   }
            // }
          });
        });
        this.loading = false;
        this.dislable = false;
      }
      this.KJSQuFuList = res.data;
    },

    //获取保存的属性
    async getbaocunInfoList() {
      let obj = {};
      obj.gameId = this.queryParams.gameId;
      obj.config = this.salePartner.saleName;
      obj.interGameId = this.queryParams.interGameId;
      const res = await getBaocunAttrInfo({ ...this.paramsData, ...obj });
      console.log(res);
      if (res.code == 200) {
        this.AllInfoList = res.data;
        this.getotherList();
      }
    },

    //获取接口属性
    // getAttrs() {

    // },
    //获取于都属性
    async getYdAttr() {
      let obj = {};
      obj.gameId = this.queryParams.gameId;
      obj.type = 1;
      const res = await YDAttr(obj);
      console.log("res", res);
      this.YdAttr = res.data;

      this.refreshTable = false;
      this.isExpandAll = false;
      this.$nextTick(() => {
        this.refreshTable = true;
      });
    },
    //获取其他属性
    async getotherAttr() {
      let obj = {};
      obj.saleName = this.salePartner.saleName;
      obj.gameId = this.queryParams.interGameId;
      obj.type = 1;
      const res = await KJSAttr({ ...this.paramsData, ...obj });
      console.log("res", res);
      res.data.forEach((item) => {
        item.interRadioReqs = item.interServerRes;
        if (item.interServerRes && item.interServerRes.length != 0) {
          item.interServerRes.forEach((dict) => {
            dict.interRadioReqs = dict.interServerRes;
          });
        }
      });
      if (this.AllInfoList.radioAttr) {
        this.loading = true;
        this.dislable = true;
        res.data.forEach((item) => {
          this.AllInfoList.radioAttr.interRadioReqs.forEach((dict) => {
            if (
              (item.id == dict.id && dict.YdConfigId && dict.YdConfigName) ||
              (item.id == dict.id && dict.defaultValue)
            ) {
              item.YdConfigId = dict.YdConfigId;
              item.YdConfigName = dict.YdConfigName;
              item.InterConfigId = dict.InterConfigId;
              item.InterConfigName = dict.InterConfigName;
              item.defaultValue = dict.defaultValue;
              if (dict.interRadioReqs && dict.interRadioReqs.length != 0) {
                item.interRadioReqs.forEach((t1) => {
                  dict.interRadioReqs.forEach((s1) => {
                    if (
                      (t1.id == s1.id && s1.YdConfigId && s1.YdConfigName) ||
                      (t1.id == s1.id && s1.defaultValue)
                    ) {
                      t1.YdConfigId = s1.YdConfigId;
                      t1.YdConfigName = s1.YdConfigName;
                      t1.InterConfigId = s1.InterConfigId;
                      t1.InterConfigName = s1.InterConfigName;
                      t1.defaultValue = s1.defaultValue;
                    }
                  });
                });
              }
            }
          });
        });
        this.loading = false;
        this.dislable = false;
      }
      this.KJSAttr = res.data;
    },
    //////////////////单选
    //修改本地数据-单选
    handleUpdateRadio(item) {
      const ddd = document.querySelector(".mained");
      ddd.style.width = "1286px";
      console.log("item", item);
      this.selectedRadioValues = [];
      this.itemObjRadio = item;
      this.dialogFormVisibleRadio = true;
      this.Radioform.YdConfigId = item.YdConfigId;
      this.Radioform.YdConfigName = item.YdConfigName;
    },
    //确认单选
    okSureRadio() {
      this.itemObjRadio.YdConfigId = this.Radioform.YdConfigId;
      this.itemObjRadio.YdConfigName = this.Radioform.YdConfigName;
      this.itemObjRadio.InterConfigId = this.itemObjRadio.id;
      this.itemObjRadio.InterConfigName = this.itemObjRadio.name;
      const myList = this.YdAttr;
      const otherList = this.KJSAttr;
      this.dialogFormVisibleRadio = false;
      myList.forEach((item) => {
        otherList.forEach((dict) => {
          if (item.filedName == dict.name || dict.YdConfigId == item.id) {
            item.flag = true;
            dict.flag = true;
          }

          if (item.childAttributes && item.childAttributes.length != 0) {
            item.childAttributes.forEach((i) => {
              if (dict.interRadioReqs && dict.interRadioReqs.length != 0) {
                dict.interRadioReqs.forEach((s) => {
                  if (i.fieldName == s.name || s.YdConfigId == i.id) {
                    s.flag = true;
                    i.flag = true;
                  }

                  //   if (i.childAttributes && i.childAttributes.length != 0) {
                  //     i.childAttributes.forEach(t1 => {
                  //       if (t1.fieldName == s.name || s.YdConfigId == t1.id) {
                  //         s.flag = true
                  //         t1.flag = true
                  //       }
                  //     })
                  //   }
                });
              }
            });
          }
        });
      });

      this.$set(this.KJSAttr, this.itemObjRadio.id + "qwer", this.itemObjRadio);
      const ddd = document.querySelector(".mained");
      ddd.style.width = "1290px";

      // this.refreshTable = false;
      // this.isExpandAll = false;
      // this.$nextTick(() => {
      //   this.refreshTable = true;
      // });
      // this.$forceUpdate()
    },
    //清楚单选表单
    closeRadio() {
      this.dialogFormVisibleRadio = false;
      this.Radioform = {
        YdConfigId: null,
        YdConfigName: null,
      };
    },
    //一键匹配单选属性
    Oneclickradio() {
      const myList = this.YdAttr;
      const otherList = this.KJSAttr;
      myList.forEach((item) => {
        otherList.forEach((dict) => {
          if (item.fieldName == dict.name) {
            dict.YdConfigId = item.id;
            dict.YdConfigName = item.fieldName;
            dict.InterConfigId = dict.id;
            dict.InterConfigName = dict.name;
            console.log("333", dict);
            item.flag = true;
            dict.flag = true;
          }

          if (item.childAttributes && item.childAttributes.length != 0) {
            item.childAttributes.forEach((i) => {
              if (dict.interRadioReqs && dict.interRadioReqs.length != 0) {
                dict.interRadioReqs.forEach((s) => {
                  if (i.fieldName == s.name) {
                    s.YdConfigId = i.id;
                    s.YdConfigName = i.fieldName;
                    s.InterConfigId = s.id;
                    s.InterConfigName = s.name;
                    console.log("sss", s);
                    s.flag = true;
                    i.flag = true;
                  }
                });
              }
            });
          }
        });
      });

      this.refreshTable = false;
      this.isExpandAll = false;
      this.$nextTick(() => {
        this.refreshTable = true;
      });
    },
    //保存单选属性
    async baocunRadioAttr() {
      let obj = {};
      obj.config = this.salePartner.saleName;
      obj.ydGameId = this.queryParams.gameId;
      obj.interGameId = this.queryParams.interGameId;
      obj.interRadioReqs = JSON.stringify(this.KJSAttr);
      const res = await BaocunRadioAttrInfo({ ...this.paramsData, ...obj });
      console.log(res);
      if (res.code == 200) {
        this.getcheckBoxAttrs();
        this.switch2 = false;
        this.switch3 = true;
      }
      this.$message.success("保存成功！");
    },
    ///////////////////////////多选
    getcheckBoxAttrs() {
      this.getcheckBoxYdAttr();
      this.getcheckBoxotherAttr();
    },
    //获取于都属性
    async getcheckBoxYdAttr() {
      let obj = {};
      obj.gameId = this.queryParams.gameId;
      obj.type = 2;
      const res = await YDAttr(obj);
      console.log("res", res);
      this.YdCheckBoxAttr = res.data;
    },
    //获取其他属性
    async getcheckBoxotherAttr() {
      let obj = {};
      obj.saleName = this.salePartner.saleName;
      obj.gameId = this.queryParams.interGameId;
      obj.type = 2;
      const res = await KJSAttr({ ...this.paramsData, ...obj });
      console.log("res", res);
      res.data.forEach((item) => {
        item.interCheckBoxReqs = item.interServerRes;
        if (item.interCheckBoxReqs && item.interCheckBoxReqs.length != 0) {
          item.interCheckBoxReqs.forEach((dict) => {
            dict.interCheckBoxReqs = dict.interServerRes;
          });
        }
      });

      if (this.AllInfoList.checkAttr) {
        this.loading = true;
        this.dislable = true;
        res.data.forEach((item) => {
          this.AllInfoList.checkAttr.interCheckBoxReqs.forEach((dict) => {
            if (
              (item.id == dict.id && dict.YdConfigId && dict.YdConfigName) ||
              (item.id == dict.id && dict.defaultValue)
            ) {
              item.YdConfigId = dict.YdConfigId;
              item.YdConfigName = dict.YdConfigName;
              item.InterConfigId = dict.InterConfigId;
              item.InterConfigName = dict.InterConfigName;
              item.defaultValue = dict.defaultValue;
              if (
                dict.interCheckBoxReqs &&
                dict.interCheckBoxReqs.length != 0
              ) {
                item.interCheckBoxReqs.forEach((t1) => {
                  dict.interCheckBoxReqs.forEach((s1) => {
                    if (
                      (t1.id == s1.id && s1.YdConfigId && s1.YdConfigName) ||
                      (t1.id == s1.id && s1.defaultValue)
                    ) {
                      t1.YdConfigId = s1.YdConfigId;
                      t1.YdConfigName = s1.YdConfigName;
                      t1.InterConfigId = s1.InterConfigId;
                      t1.InterConfigName = s1.InterConfigName;
                      t1.defaultValue = s1.defaultValue;
                    }
                  });
                });
              }
            }
          });
        });
        this.loading = false;
        this.dislable = false;
      }
      this.KJSCheckBoxAttr = res.data;

      this.refreshTable = false;
      this.isExpandAll = false;
      this.$nextTick(() => {
        this.refreshTable = true;
      });
    },
    //一键获取多选属性
    OneclickcheckBox() {
      const myList = this.YdCheckBoxAttr;
      const otherList = this.KJSCheckBoxAttr;
      myList.forEach((item) => {
        otherList.forEach((dict) => {
          if (item.fieldName == dict.name) {
            dict.YdConfigId = item.id;
            dict.YdConfigName = item.fieldName;
            dict.InterConfigId = dict.id;
            dict.InterConfigName = dict.name;
            console.log("333", dict);
            item.flag = true;
            dict.flag = true;
          }

          if (item.childAttributes && item.childAttributes.length != 0) {
            item.childAttributes.forEach((i) => {
              if (
                dict.interCheckBoxReqs &&
                dict.interCheckBoxReqs.length != 0
              ) {
                dict.interCheckBoxReqs.forEach((s) => {
                  if (i.fieldName == s.name) {
                    s.YdConfigId = i.id;
                    s.YdConfigName = i.fieldName;
                    s.InterConfigId = s.id;
                    s.InterConfigName = s.name;
                    console.log("sss", s);
                    s.flag = true;
                    i.flag = true;
                  }
                });
              }
            });
          }
        });
      });

      this.refreshTable = false;
      this.isExpandAll = false;
      this.$nextTick(() => {
        this.refreshTable = true;
      });
    },
    //修改本地数据-多选
    handleUpdatecheckBox(item) {
      const ddd = document.querySelector(".mained");
      ddd.style.width = "1286px";
      console.log("item", item);
      this.selectedRadioCheckBox = [];
      this.itemObjcheckBox = item;
      this.dialogFormVisiblecheckBox = true;
      this.checkBoxform.YdConfigId = item.YdConfigId;
      this.checkBoxform.YdConfigName = item.YdConfigName;
    },
    //清楚单选表单
    closecheckBox() {
      this.dialogFormVisiblecheckBox = false;
      this.checkBoxform = {
        YdConfigId: null,
        YdConfigName: null,
      };
    },
    //确认多选
    okSurecheckBox() {
      this.itemObjcheckBox.YdConfigId = this.checkBoxform.YdConfigId;
      this.itemObjcheckBox.YdConfigName = this.checkBoxform.YdConfigName;
      this.itemObjcheckBox.InterConfigId = this.itemObjcheckBox.id;
      this.itemObjcheckBox.InterConfigName = this.itemObjcheckBox.name;
      const myList = this.YdCheckBoxAttr;
      const otherList = this.KJSCheckBoxAttr;
      this.dialogFormVisiblecheckBox = false;
      myList.forEach((item) => {
        otherList.forEach((dict) => {
          if (item.fieldName == dict.name || dict.YdConfigId == item.id) {
            item.flag = true;
            dict.flag = true;
          }

          if (item.childAttributes && item.childAttributes.length != 0) {
            item.childAttributes.forEach((i) => {
              if (
                dict.interCheckBoxReqs &&
                dict.interCheckBoxReqs.length != 0
              ) {
                dict.interCheckBoxReqs.forEach((s) => {
                  if (i.fieldName == s.name || s.YdConfigId == i.id) {
                    s.flag = true;
                    i.flag = true;
                  }

                  //   if (i.childAttributes && i.childAttributes.length != 0) {
                  //     i.childAttributes.forEach(t1 => {
                  //       if (t1.fieldName == s.name || s.YdConfigId == t1.id) {
                  //         s.flag = true
                  //         t1.flag = true
                  //       }
                  //     })
                  //   }
                });
              }
            });
          }
        });
      });

      this.$set(
        this.KJSCheckBoxAttr,
        this.itemObjcheckBox.id + "qwer",
        this.itemObjcheckBox
      );
      const ddd = document.querySelector(".mained");
      ddd.style.width = "1290px";

      // this.refreshTable = false;
      // this.isExpandAll = false;
      // this.$nextTick(() => {
      //   this.refreshTable = true;
      // });
      // this.$forceUpdate()
    },
    //保存多选属性
    async baocunCheckBoxAttr() {
      let obj = {};
      obj.config = this.salePartner.saleName;
      obj.ydGameId = this.queryParams.gameId;
      obj.interGameId = this.queryParams.interGameId;
      obj.interCheckBoxReqs = JSON.stringify(this.KJSCheckBoxAttr);
      const res = await BaocunCheckBoxAttrInfo({ ...this.paramsData, ...obj });
      console.log(res);
      if (res.code == 200) {
        this.getInputAttr();
        this.switch3 = false;
        this.switch6 = true;
      }
      this.$message.success("保存成功！");
    },
    ////////////////////////输入框
    getInputAttr() {
      this.getinputYdAttr();
      this.getinputotherAttr();
    },
    //获取于都属性
    async getinputYdAttr() {
      let obj = {};
      obj.gameId = this.queryParams.gameId;
      obj.type = 3;
      const res = await YDAttr(obj);
      console.log("res", res);
      this.YdInputAttr = res.data;
    },
    //获取其他属性
    async getinputotherAttr() {
      let obj = {};
      obj.saleName = this.salePartner.saleName;
      obj.gameId = this.queryParams.interGameId;
      obj.type = 3;
      const res = await KJSAttr({ ...this.paramsData, ...obj });
      console.log("res", res);
      if (this.AllInfoList.inputAttr) {
        this.loading = true;
        this.dislable = true;
        res.data.forEach((item) => {
          this.AllInfoList.inputAttr.inputJson.forEach((dict) => {
            if (
              (item.id == dict.id && dict.aavName && dict.fieldName) ||
              (item.id == dict.id && dict.defaultValue)
            ) {
              item.aavName = dict.aavName;
              item.fieldName = dict.fieldName;
              item.interId = dict.interId;
              item.interName = dict.interName;
              item.defaultValue = dict.defaultValue;
            }
          });
        });
        this.loading = false;
        this.dislable = false;
      }
      this.KJSInputAttr = res.data;
    },
    //一键匹配输入框属性
    Oneclickinput() {
      const myList = this.YdInputAttr;
      const otherList = this.KJSInputAttr;
      myList.forEach((item) => {
        otherList.forEach((dict) => {
          if (item.fieldName == dict.name) {
            dict.aavName = item.aavName;
            dict.fieldName = item.fieldName;
            dict.interId = dict.id;
            dict.interName = dict.name;
            console.log("333", dict);
            item.flag = true;
            dict.flag = true;
          }
        });
      });

      this.refreshTable = false;
      this.isExpandAll = false;
      this.$nextTick(() => {
        this.refreshTable = true;
      });
    },
    handleUpdateInput(item) {
      const ddd = document.querySelector(".mained");
      ddd.style.width = "1286px";
      console.log("item", item);
      this.selectedInput = [];
      this.itemObjInput = item;
      this.dialogFormVisibleInput = true;
      this.Inputform.aavName = item.aavName;
      this.Inputform.fieldName = item.fieldName;
    },
    closeInput() {
      this.dialogFormVisibleInput = false;
      this.Inputform = {
        aavName: null,
        fieldName: null,
      };
    },
    okSureInput() {
      //   console.log('123');
      this.itemObjInput.aavName = this.Inputform.aavName;
      this.itemObjInput.fieldName = this.Inputform.fieldName;
      this.itemObjInput.interId = this.itemObjInput.id;
      this.itemObjInput.interName = this.itemObjInput.name;
      const myList = this.YdInputAttr;
      const otherList = this.KJSInputAttr;
      this.dialogFormVisibleInput = false;
      myList.forEach((item) => {
        otherList.forEach((dict) => {
          if (item.filedName == dict.name || item.aavName == dict.aavName) {
            item.flag = true;
            dict.flag = true;
          }
        });
      });

      this.$set(
        this.KJSInputAttr,
        this.itemObjInput.id + "qwer",
        this.itemObjInput
      );
      const ddd = document.querySelector(".mained");
      ddd.style.width = "1290px";

      // this.refreshTable = false;
      // this.isExpandAll = false;
      // this.$nextTick(() => {
      //   this.refreshTable = true;
      // });

      // this.$forceUpdate()
    },
    //保存输入框属性
    async baocunInputAttr() {
      let obj = {};
      obj.config = this.salePartner.saleName;
      obj.ydGameId = this.queryParams.gameId;
      obj.interGameId = this.queryParams.interGameId;
      obj.inputJson = this.KJSInputAttr;
      const res = await BaocunInputAttrInfo({ ...this.paramsData, ...obj });
      console.log(res);
      if (res.code == 200) {
        // this.switch6 = false
        // this.switchFlag = false
        this.$router.push("/api/index/channelList");
      }
      this.$message.success("保存成功！");
    },
  },
};
</script>

<style lang="scss" scoped>
.mained {
  width: 1289px;
}

.main {
  width: 100%;
  display: flex;
  .titleOne {
    width: 50%;
    text-align: center;
    font-size: 26px;
    font-weight: bold;
    padding-bottom: 30px;
    color: #942d9b;
  }

  .one {
    width: 37%;
  }

  .two {
    width: 63%;
  }
}

.box {
  width: 100%;
  display: flex;
  .one {
    // width: 50%;
    text-align: center;
    .title {
      font-size: 26px;
      font-weight: bold;
      padding-bottom: 30px;
      color: #942d9b;
    }

    .nav {
      display: flex;
      align-items: center;
      justify-content: center;
    }
  }

  .two {
    width: 37%;
  }

  .three {
    width: 63%;
  }
}

.gameBtn {
  padding: 26px 0;
  text-align: center;
}

::v-deep .el-table__row.el-table__row--level-0 {
  background-color: #eae7e7;

  .el-table_2_column_5.el-table__cell {
    background-color: #eae7e7;
  }
}
</style>
